import request from '@/utils/request'
/**
 * 获取文章
 * @param {*} channel_id
 * @param {*} timestamp
 * @returns
 */
export function reqGetAriticles(channel_id, timestamp) {
  return request.get('/v1_0/articles', {
    params: {
      channel_id,
      timestamp
    }
  })
}

/**
 * 文章不感兴趣
 * @param {*} target 文章Id
 * @returns
 */
export function reqDislikeArticle(target) {
  return request.post('/v1_0/article/dislikes', {
    target
  })
}

/**
 * 二级举报
 * @param {*} target
 * @param {*} type
 * @returns
 */
export function reqReportAriticle(target, type) {
  return request.post('/v1_0/article/reports', {
    target,
    type
  })
}
/**
 * 获取文章详情
 * @param {*} id
 * @returns
 */
export function reqGetAriticlesDetail(id) {
  return request.get('/v1_0/articles/' + id)
}
/**
 * 关注作者
 * @param {*} target 作者id
 * @returns
 */
export function reqFollow(target) {
  return request.post('/v1_0/user/followings', {
    target
  })
}
/**
 * 取关作者
 * @param {*} target 作者id
 * @returns
 */
export function reqUnfollow(target) {
  return request.delete('/v1_0/user/followings/' + target)
}

/**
 * 取消点赞
 * @param {*} target
 * @returns
 */
export const reqDelLike = target => request.delete(`/v1_0/article/likings/${target}`)
/**
 * 点赞
 * @param {*} target 文章id
 * @returns
 */
export const reqAddLike = target => request.post(`/v1_0/article/likings`, { target })

export const reqDelDislike = target => request.delete(`/v1_0/article/dislikes/${target}`)
export const reqAddDislike = target => request.post(`/v1_0/article/dislikes`, { target })
